const { AsyncParallelBailHook } = require("tapable")

const hook = new AsyncParallelBailHook(["name", "age"])

console.time("time")
// callback函数表示结束
hook.tapAsync("fn1", function (name, age, callback) {
	setTimeout(() => {
		console.log(`fn1=====>${name},${age}`)
		callback()
	}, 2000)
})


hook.tapAsync("fn2", function (name, age, callback) {
	setTimeout(() => {
		console.log(`fn2=====>${name},${age}`)
		callback("err")
	}, 2000)
})

hook.tapAsync("fn3", function (name, age, callback) {
	setTimeout(() => {
		console.log(`fn3=====>${name},${age}`)
		callback()
	}, 3000)
})

hook.callAsync("lx", 25, function () {
	console.log("回调")
	console.timeEnd("time")
})



